import 'package:flutter/material.dart';
import 'package:huajianshe_app/common/res.dart';
import 'package:huajianshe_app/pages/user_info/model/UserModel.dart';

import 'MemberItem.dart';

class MemberItemWithPY extends StatelessWidget {

  final FriendsData? data;
  final EdgeInsets padding;

  const MemberItemWithPY(this.data, {Key? key, this.padding = EdgeInsets.zero,}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return
      Padding(padding: padding, child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [
        Text(data?.initial ?? '', style: TS(15, C.gray333, fontWeight: FontWeight.bold)),
        H(7),
        ...buildList()
      ]));
  }

  List<Widget> buildList() {
    List<Widget> result = [];
    for (int i = 0; i < (data?.data?.length ?? 0); i++) {
      if (i > 0) result.add(DD(paddingLeft: 48));
      result.add(MemberItem(data?.data?[i]));
      print('${data?.data?[i].userInfo?.nickname}');
    }
    return result;
  }
}